package ferp.core.state;

import ferp.core.game.Game;
import ferp.core.game.Input;
import ferp.core.game.Settings;
import ferp.core.player.Profile;

/**
 * User: olegs
 * Date: 10/12/12 8:43 PM
 */
public class ShowInitialPosition extends State
{
  @Override
  public int process(Game.Listener listener, Profile profile, Game g, Settings settings, Input input) throws Game.Error
  {
    // clear input options, otherwise restoring might not work properly
    g.options.clear();

    // save the current state
    save(profile);

    g.options.set(Input.Options.WAIT_FOR_TOUCH);

    // fire an appropriate event
    listener.onShowInitialPosition(g, settings);

    // set the next state to ShowPool1
    g.set(State.showPool1);

    return Result.SHOW_OPTIONS;
  }
}
